package com.house.service;

import com.house.util.ClassPathResourceReader;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import java.io.IOException;

@Service
public class AdminService {
    public String getmenu(Authentication auth) throws IOException {
        if(auth.getAuthorities().contains(new SimpleGrantedAuthority("ROLE_sadmin"))){
            return new  ClassPathResourceReader("static/layui2/api/init_sadmin.json").getContent("UTF-8");
        }else{
            return new  ClassPathResourceReader("static/layui2/api/init_admin.json").getContent("UTF-8");
        }

    }
}
